package com.tx.studentManager.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

/**
 * @date 2015-08-14
 * @author 此生唯晴
 * @描述 数据库实体对象-用户角色
 */
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "role", catalog = "studentManager")
public class Role extends BaseModel{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 角色ID
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name= "roleId",nullable = false)
	private Integer roleId;
	/**
	 * 中文角色名
	 */
	@Column(length = 10,nullable = false)
	private String description;
	
	/**
	 * 英文角色名，用于匹配权限，中文不方便
	 */
	@Column(length = 10,nullable = false)
	private String roleName;
	/**
	 * 用户,级联删除、更新、刷新,直接加载
	 */
//	@ManyToMany(cascade={CascadeType.ALL},fetch = FetchType.LAZY)
//	@JoinTable(name = "roles_users",joinColumns=@JoinColumn(name = "roleId"),inverseJoinColumns=@JoinColumn(name="userId"))
//	private Set<User>users;

	public Integer getRoleId() {
		return roleId;
	}

	public void setRoleId(Integer roleId) {
		this.roleId = roleId;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
/*
	public Set<User> getUsers() {
		return users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}
*/

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
}
